<template>
  <div class="screen-container">
    <div class="title">
      <div class="leftInfo f18">
        <div class="city">济南</div>
        <div class="weather">
          <div class="weatherLogo"></div>
          <div class="weatherInfo f16">
            <div>18-26℃</div>
            <div>多云转晴</div>
          </div>
        </div>
      </div>
      <div class="f32">雨污分流在线监测管理系统</div>
      <div class="rightTime">
        <div class="time">{{ realTime }}</div>
        <div class="jump" @click="jump"></div>
      </div>
    </div>
    <div class="alarmInfo">
      <alarm-info :alarm-info-data="alarmInfoData"/>
    </div>
    <div class="screenInfo">
      <el-row :gutter="20">
        <el-col :span="6">
          <div class="grid-content bg-purple">
            <alarm-list />
          </div>
        </el-col>
        <el-col :span="12">
          <div class="grid-content bg-purple">
            <div class="mapWarp">
              <div class="map">
                <map-chat :map-chat-data="mapChatData"/>
              </div>
              <div class="chat">
                <chat-statistics :chat-statistics-data="chatStatisticsData"/>
              </div>
            </div>
          </div>
        </el-col>
        <el-col :span="6">
          <div class="grid-content bg-purple">
            <discharge-statistics/>
          </div>
        </el-col>
      </el-row>
    </div>
    <!--<bottom-menu/>-->
  </div>
</template>

<script>
import MapChat from '@/views/home/components/MapChat'
// import BottomMenu from '@/views/home/components/BottomMenu'
import AlarmInfo from '@/views/home/components/AlarmInfo'
import AlarmList from '@/views/home/components/AlarmList'
import DischargeStatistics from '@/views/home/components/DischargeStatistics'
import ChatStatistics from '@/views/home/components/ChatStatistics'
import resize from '@/utils/mixins/resize'
import { currentTime } from '@/utils/common'

export default {
  name: 'Home',
  mixins: [resize],
  components: {
    // BottomMenu,
    MapChat,
    AlarmInfo,
    AlarmList,
    DischargeStatistics,
    ChatStatistics
  },
  data() {
    return {
      realTime: '',
      timer: null,
      alarmInfoData: {
        enterpriseNumber: '0',
        substationNumber: '0',
        substationOnLineNumber: '0',
        videoOnLineNumber: '0',
        callThePoliceSubstationNumber: '0',
        dealWithNumber: '0',
        callThePoliceNumber: '0'
      },
      mapChatData: [],
      chatStatisticsData: []
    }
  },
  watch: {},
  activated() {

  },
  deactivated() {
    // window.clearInterval(this.timer)
  },
  created() {
    this.getCurrentTime()
    this.getAllList()
  },
  methods: {
    jump() {
      this.$router.push('/onlineMonitor/realTimeList')
    },
    getCurrentTime() {
      window.clearInterval(this.timer)
      this.timer = setInterval(() => {
        this.realTime = currentTime()
      }, 1000)
    },
    async getAllList() {
      const res = await this.$http.get('/screenData/list')
      if (res.code == '200') {
        const resData = res.data
        this.alarmInfoData.substationNumber = resData.enterpriseNumber
        this.alarmInfoData.substationNumber = resData.substationNumber
        this.alarmInfoData.substationOnLineNumber = resData.substationOnLineNumber
        this.alarmInfoData.videoOnLineNumber = resData.videoOnLineNumber
        this.alarmInfoData.callThePoliceSubstationNumber = resData.callThePoliceSubstationNumber
        this.alarmInfoData.callThePoliceNumber = resData.callThePoliceNumber
        this.alarmInfoData.dealWithNumber = resData.dealWithNumber
        this.mapChatData = resData.screenSubstationList
        this.chatStatisticsData = resData.screenStCodeSubNumberList
      }
    }
  }

}
</script>
<style lang="scss" scoped>
.screen-container {
  width: 100%;
  min-height: 100%;
  background: url(../../assets/images/screen/screenBg.jpg) no-repeat;
  background-size: 100% 100%;

  .title {
    width: 100%;
    height: 60px;
    text-align: center;
    font-family: YouSheBiaoTiHei;
    letter-spacing: 2px;
    font-weight: 800;
    color: #CBDDFD;
    padding-top: 22px;
    margin-bottom: 30px;

    .leftInfo {
      font-weight: normal;
      display: flex;
      justify-content: flex-start;
      position: absolute;
      top: 22px;
      left: 80px;

      .city {
        padding: 10px 28px;
        background: #97BDFA;
        border-radius: 10px;
        color: #081D80;
      }

      .weather {
        display: flex;
        justify-content: flex-start;

        .weatherLogo {
          width: 35px;
          height: 35px;
          margin: 0 20px;
          background: #46EBFF;
        }

        .weatherInfo {
          margin-right: 10px;
        }
      }
    }

    .rightTime {
      display: flex;
      justify-content: flex-start;
      position: absolute;
      top: 22px;
      right: 160px;
      line-height: 3;

      .jump {
        margin-left: 20px;
        width: 28px;
        height: 28px;
        cursor: pointer;
        background: url("../../assets/images/screen/home.png") no-repeat;
        background-size: 100% 100%;
        position: relative;
        top: 10px;
      }
    }
  }

  .alarmInfo {
    width: 100%;
  }

  .screenInfo {
    width: 100%;
    padding: 0 15px;
    margin-top: 25px;

    .mapWarp {
      height: 700px;

      .map {
        width: 100%;
        height: 480px;
        margin-bottom: 20px;
      }

      .chat {
        width: 100%;
        height: 200px;
      }
    }
  }
}
</style>

